<template>
  <div class="container_width common_wrap basics_detail">
    <el-divider>标准计划详情</el-divider>
    <el-card class="box-card box-card1 mb-10">
      <h3 class="detail_title">
        {{ infoData.title }}
      </h3>
      <div class="detail_title_en">
        {{ infoData.enTitle }}
      </div>
      <div class="tag_wrap">
        <el-tag>{{ infoData.standardization }}</el-tag>
        <el-tag type="success">{{ infoData.standardProperty }}</el-tag>
      </div>
    </el-card>
    <el-card class="box-card">
      <div class="directory_wrap">
        <div class="left_directory">目 录</div>
        <div class="right_directory">
          <div class="item">
            <p><a @click="changeHash('#status')">1. 标准状态</a></p>
            <p><a @click="changeHash('#base')">2. 基础信息</a></p>
            <p><a @click="changeHash('#info')">3. 适用范围</a></p>
          </div>
          <div>
            <p><a @click="changeHash('#unit')">4. 起草单位</a></p>
          </div>
        </div>
      </div>

      <div class="detail_subtitle" id="status">标准状态</div>
      <el-steps
        :space="250"
        :active="active"
        finish-status="success"
        align-center
      >
        <el-step title="起草"></el-step>
        <el-step title="征求意见"></el-step>
        <el-step title="审查"></el-step>
        <el-step title="批准"></el-step>
        <el-step title="终止"></el-step>
      </el-steps>

      <div class="detail_subtitle" id="base">基础信息</div>

      <el-descriptions class="descriptions_wrap" :column="2" border>
        <el-descriptions-item label="标准号">{{
          infoData.standardPlanNo
        }}</el-descriptions-item>
        <el-descriptions-item label="标准类型">{{
          infoData.standardType
        }}</el-descriptions-item>
        <el-descriptions-item label="计划下达日期">{{
          infoData.scheduledDate
        }}</el-descriptions-item>
        <el-descriptions-item label="项目周期">{{
          infoData.cycle
        }}</el-descriptions-item>
        <el-descriptions-item label="中国标准分类号">{{
          infoData.ccs
        }}</el-descriptions-item>
        <el-descriptions-item label="国际标准分类号">{{
          infoData.ics
        }}</el-descriptions-item>
        <el-descriptions-item label="制修订">{{
          infoData.standardization
        }}</el-descriptions-item>
        <el-descriptions-item label="技术委员会">{{
          infoData.techCommittee
        }}</el-descriptions-item>
        <el-descriptions-item label="起草部门">{{
          infoData.draftsDept
        }}</el-descriptions-item>
      </el-descriptions>

      <div class="detail_subtitle" id="info">适用范围</div>
      <div class="detail_subinfo detail_subinfo1">
        {{ infoData.introduction }}
      </div>
      <div class="detail_subtitle" id="unit">起草单位</div>
      <div class="detail_subinfo">
        <p class="bus">
          <span v-for="item in infoData.draftsUnit" :key="item">{{
            item
          }}</span>
        </p>
      </div>
    </el-card>
     
  </div>
</template>

<script>
import { standardPlanInfo } from "@/api/home.js";
export default {
  name: "",
  data() {
    return {
      plan: "",
      infoData: {},
      active: 0,
    };
  },
  created() {
    this.plan = this.$route.query.no;
    this.getDetail();
  },
  methods: {
    getDetail() {
      standardPlanInfo({ standardPlanNo: this.plan }).then((res) => {
        if (res.code == 200) {
          this.infoData = res.data;
          this.infoData.draftsUnit = this.infoData.draftsUnit.split("、");
          switch (this.infoData.progress) {
            case "起草":
              this.active = 1;
              break;
            case "征求意见":
              this.active = 2;
              break;
            case "审查":
              this.active = 3;
              break;
            case "批准":
              this.active = 4;
              break;
            case "终止":
              this.active = 5;
              break;
            default:
              this.active = 0;
              break;
          }
        }
      });
    },
    changeHash(idName) {
      document.querySelector(idName).scrollIntoView(true);
    },
  },
};
</script>

<style lang="scss">
.basics_detail {
  .detail_title {
    margin-bottom: 5px;
  }
  .detail_title_en {
    margin-bottom: 10px;
  }
  .tag_wrap {
    .el-tag {
      margin-right: 10px;
    }
  }
  .directory_wrap {
    height: 150px;
    padding: 0 30px;
    margin-bottom: 30px;
    display: flex;
    .left_directory {
      width: 80px;
      height: 150px;
      text-align: center;
      line-height: 150px;
      background-color: #f2f2f2f9;
      border-right: 1px solid #d5d4d4;
    }
    .right_directory {
      display: flex;
      width: 500px;
      padding: 20px 30px;
      line-height: 30px;
      color: #2f74d3;
      .item {
        width: 200px;
      }
    }
  }
  .el-steps {
    justify-content: center;
  }
  .el-step__title {
    font-size: 14px;
  }
  .descriptions_wrap {
    margin: 20px;
  }

  .el-descriptions-item__label.is-bordered-label {
    width: 150px;
  }
  .el-descriptions-item__content {
    width: 300px;
  }

  .detail_subinfo1 {
    padding-left: 50px;
    padding-right: 50px;
  }
  .box-card {
    .el-card__body {
      padding: 20px 30px;
    }
  }
  .box-card1 {
    .el-card__body {
      border-top: 10px solid #2f74d3;
    }
  }
  .detail_subtitle {
    font-weight: bold;
    margin: 30px 0 15px;
    border-left: 4px solid #2f74d3;
    padding-left: 15px;
  }
  .detail_subinfo {
    font-size: 14px;
    line-height: 28px;
    padding-bottom: 20px;
    border-bottom: 1px solid #d5d4d4;
    p {
      padding-left: 50px;
    }
    .bus span {
      display: inline-block;
      width: 350px;
    }
    .user span {
      display: inline-block;
      width: 250px;
      i {
        margin-right: 10px;
      }
    }
  }
}
</style>
